package cn.scut.srp.mapper;

import cn.scut.srp.model.entity.Student;
import cn.scut.srp.model.entity.Teacher;
import cn.scut.srp.model.vo.CourseInfoVo;
import cn.scut.srp.model.vo.MessageVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface TeacherMapper {
    @Select("""
            select id,teacher_account,password,teacher_name
            from machine_room.teacher where teacher_account = #{teacher_account} AND is_deleted = false
            """)
    @ResultType(Teacher.class)
    Teacher getTeacherByAccount(String teacher_account);
    @Insert("""
            insert into machine_room.message(commenter_account,message_content) values (#{teacherAccount},#{messageContent})
            """)
    void insertMeaasge(String teacherAccount, String messageContent);
    @Insert("""
    insert into course_info(course_name,teacher_id,class_name) 
    values (#{courseInfoVo.courseName},#{teacherId},#{courseInfoVo.className})
    """)
    void insertCourse(Long teacherId,CourseInfoVo courseInfoVo);
}